﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ConrtolLibrary
{
    public partial class ROVHUD : UserControl
    {

        #region Properties

        public int Value1
        {
            get { return valueBar1.Value;  }
            set { valueBar1.Value = value; }
        }

        public int Value2
        {
            get { return valueBar2.Value; }
            set { valueBar2.Value = value;  }
        }

        public int Value3
        {
            get { return valueBar3.Value; }
            set { valueBar3.Value = value;  }
        }

        public StatusLightMode Polybot
        {
            get { return statusLightPolyBot.Status; }
            set { statusLightPolyBot.Status = value; }
        }

        public StatusLightMode Joystick
        {
            get { return statusLightJoyStick.Status; }
            set { statusLightJoyStick.Status = value; }
        }

        public StatusLightMode Torpedo1
        {
            get { return statusLightTorp1.Status; }
            set { statusLightTorp1.Status = value;  }
        }

        public StatusLightMode Torpedo2
        {
            get { return statusLightTorp2.Status; }
            set { statusLightTorp2.Status = value; }
        }

        public StatusLightMode Torpedo3
        {
            get { return statusLightTorp3.Status; }
            set { statusLightTorp3.Status = value;  }
        }

        public StatusLightMode Torpedo4
        {
            get { return statusLightTorp4.Status; }
            set { statusLightTorp4.Status = value;  }
        }

        #endregion

        public ROVHUD()
        {
            InitializeComponent();
        }

        private void timerClock_Tick(object sender, EventArgs e)
        {
            updateClock(DateTime.Now.ToShortTimeString());
        }

        private delegate void updateClockDel(string s);
        private void updateClock(string s)
        {
            if (InvokeRequired)
            {
                updateClockDel del = new updateClockDel(updateClock);
                Invoke(del, s);
            }
            else
            {
                labelTime.Text = s;
                Invalidate();
            }
        }

        private delegate void updateThrusterLevelsDel(int t1, int t2, int t3);
        public void updateThrusterLevels(int left, int right, int vert)
        {
            if (InvokeRequired)
            {
                updateThrusterLevelsDel del = new updateThrusterLevelsDel(updateThrusterLevels);
                Invoke(del, left, right, vert);
            }
            else
            {
                Value1 = left;
                Value2 = right;
                Value3 = vert;
            }
        }

        private delegate void updatePerphStatusDel(StatusLightMode Polybot, StatusLightMode Joystick);
        public void updatePerphStatus(StatusLightMode Polybot, StatusLightMode Joystick)
        {
            if (InvokeRequired)
            {
                updatePerphStatusDel del = new updatePerphStatusDel(updatePerphStatus);
                Invoke(del, Polybot, Joystick);
            }
            else
            {
                this.Polybot = Polybot;
                this.Joystick = Joystick;
            }
        }

        private delegate void updateTropedoStatusDel(StatusLightMode torp1, StatusLightMode torp2, StatusLightMode torp3, StatusLightMode torp4);
        public void updateTropedoStatus(StatusLightMode torp1, StatusLightMode torp2, StatusLightMode torp3, StatusLightMode torp4)
        {
            if (InvokeRequired)
            {
                updateTropedoStatusDel del = new updateTropedoStatusDel(updateTropedoStatus);
                Invoke(del, torp1, torp2, torp3, torp4);
            }
            else
            {
                this.Torpedo1 = torp1;
                this.Torpedo2 = torp2;
                this.Torpedo3 = torp3;
                this.Torpedo4 = torp4;
            }
        }



    }
}
